\(\int \frac {(a+b x^2) (c+d x^2)}{e+f x^2} \, dx\) [5]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 81 \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=-\frac {(3 b d e-3 b c f-2 a d f) x}{3 f^2}+\frac {d x \left (a+b x^2\right )}{3 f}+\frac {(b e-a f) (d e-c f) \arctan \left (\frac {\sqrt {f} x}{\sqrt {e}}\right )}{\sqrt {e} f^{5/2}} \]

[Out]

-1/3*(-2*a*d*f-3*b*c*f+3*b*d*e)*x/f^2+1/3*d*x*(b*x^2+a)/f+(-a*f+b*e)*(-c*f+d*e)*arctan(x*f^(1/2)/e^(1/2))/f^(5
/2)/e^(1/2)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {542, 396, 211} \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=\frac {(b e-a f) \arctan \left (\frac {\sqrt {f} x}{\sqrt {e}}\right ) (d e-c f)}{\sqrt {e} f^{5/2}}-\frac {x (-2 a d f-3 b c f+3 b d e)}{3 f^2}+\frac {d x \left (a+b x^2\right )}{3 f} \]

[In]

Int[((a + b*x^2)*(c + d*x^2))/(e + f*x^2),x]

[Out]

-1/3*((3*b*d*e - 3*b*c*f - 2*a*d*f)*x)/f^2 + (d*x*(a + b*x^2))/(3*f) + ((b*e - a*f)*(d*e - c*f)*ArcTan[(Sqrt[f
]*x)/Sqrt[e]])/(Sqrt[e]*f^(5/2))

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 542

Int[((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.)*((e_) + (f_.)*(x_)^(n_)), x_Symbol] :> Simp[
f*x*(a + b*x^n)^(p + 1)*((c + d*x^n)^q/(b*(n*(p + q + 1) + 1))), x] + Dist[1/(b*(n*(p + q + 1) + 1)), Int[(a +
 b*x^n)^p*(c + d*x^n)^(q - 1)*Simp[c*(b*e - a*f + b*e*n*(p + q + 1)) + (d*(b*e - a*f) + f*n*q*(b*c - a*d) + b*
d*e*n*(p + q + 1))*x^n, x], x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && GtQ[q, 0] && NeQ[n*(p + q + 1) + 1
, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {d x \left (a+b x^2\right )}{3 f}+\frac {\int \frac {-a (d e-3 c f)-(3 b d e-3 b c f-2 a d f) x^2}{e+f x^2} \, dx}{3 f} \\ & = -\frac {(3 b d e-3 b c f-2 a d f) x}{3 f^2}+\frac {d x \left (a+b x^2\right )}{3 f}+\frac {((b e-a f) (d e-c f)) \int \frac {1}{e+f x^2} \, dx}{f^2} \\ & = -\frac {(3 b d e-3 b c f-2 a d f) x}{3 f^2}+\frac {d x \left (a+b x^2\right )}{3 f}+\frac {(b e-a f) (d e-c f) \tan ^{-1}\left (\frac {\sqrt {f} x}{\sqrt {e}}\right )}{\sqrt {e} f^{5/2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.89 \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=\frac {(-b d e+b c f+a d f) x}{f^2}+\frac {b d x^3}{3 f}+\frac {(b e-a f) (d e-c f) \arctan \left (\frac {\sqrt {f} x}{\sqrt {e}}\right )}{\sqrt {e} f^{5/2}} \]

[In]

Integrate[((a + b*x^2)*(c + d*x^2))/(e + f*x^2),x]

[Out]

((-(b*d*e) + b*c*f + a*d*f)*x)/f^2 + (b*d*x^3)/(3*f) + ((b*e - a*f)*(d*e - c*f)*ArcTan[(Sqrt[f]*x)/Sqrt[e]])/(
Sqrt[e]*f^(5/2))

Maple [A] (verified)

Time = 3.28 (sec) , antiderivative size = 74, normalized size of antiderivative = 0.91

method result size
default \(\frac {\frac {1}{3} b d f \,x^{3}+a d f x +b c f x -b d e x}{f^{2}}+\frac {\left (a c \,f^{2}-a d e f -b c e f +b d \,e^{2}\right ) \arctan \left (\frac {f x}{\sqrt {e f}}\right )}{f^{2} \sqrt {e f}}\) \(74\)
risch \(\frac {b d \,x^{3}}{3 f}+\frac {a d x}{f}+\frac {b c x}{f}-\frac {b d e x}{f^{2}}-\frac {\ln \left (f x +\sqrt {-e f}\right ) a c}{2 \sqrt {-e f}}+\frac {\ln \left (f x +\sqrt {-e f}\right ) a d e}{2 f \sqrt {-e f}}+\frac {\ln \left (f x +\sqrt {-e f}\right ) b c e}{2 f \sqrt {-e f}}-\frac {\ln \left (f x +\sqrt {-e f}\right ) b d \,e^{2}}{2 f^{2} \sqrt {-e f}}+\frac {\ln \left (-f x +\sqrt {-e f}\right ) a c}{2 \sqrt {-e f}}-\frac {\ln \left (-f x +\sqrt {-e f}\right ) a d e}{2 f \sqrt {-e f}}-\frac {\ln \left (-f x +\sqrt {-e f}\right ) b c e}{2 f \sqrt {-e f}}+\frac {\ln \left (-f x +\sqrt {-e f}\right ) b d \,e^{2}}{2 f^{2} \sqrt {-e f}}\) \(235\)

[In]

int((b*x^2+a)*(d*x^2+c)/(f*x^2+e),x,method=_RETURNVERBOSE)

[Out]

1/f^2*(1/3*b*d*f*x^3+a*d*f*x+b*c*f*x-b*d*e*x)+(a*c*f^2-a*d*e*f-b*c*e*f+b*d*e^2)/f^2/(e*f)^(1/2)*arctan(f*x/(e*
f)^(1/2))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 191, normalized size of antiderivative = 2.36 \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=\left [\frac {2 \, b d e f^{2} x^{3} - 3 \, {\left (b d e^{2} + a c f^{2} - {\left (b c + a d\right )} e f\right )} \sqrt {-e f} \log \left (\frac {f x^{2} - 2 \, \sqrt {-e f} x - e}{f x^{2} + e}\right ) - 6 \, {\left (b d e^{2} f - {\left (b c + a d\right )} e f^{2}\right )} x}{6 \, e f^{3}}, \frac {b d e f^{2} x^{3} + 3 \, {\left (b d e^{2} + a c f^{2} - {\left (b c + a d\right )} e f\right )} \sqrt {e f} \arctan \left (\frac {\sqrt {e f} x}{e}\right ) - 3 \, {\left (b d e^{2} f - {\left (b c + a d\right )} e f^{2}\right )} x}{3 \, e f^{3}}\right ] \]

[In]

integrate((b*x^2+a)*(d*x^2+c)/(f*x^2+e),x, algorithm="fricas")

[Out]

[1/6*(2*b*d*e*f^2*x^3 - 3*(b*d*e^2 + a*c*f^2 - (b*c + a*d)*e*f)*sqrt(-e*f)*log((f*x^2 - 2*sqrt(-e*f)*x - e)/(f
*x^2 + e)) - 6*(b*d*e^2*f - (b*c + a*d)*e*f^2)*x)/(e*f^3), 1/3*(b*d*e*f^2*x^3 + 3*(b*d*e^2 + a*c*f^2 - (b*c +
a*d)*e*f)*sqrt(e*f)*arctan(sqrt(e*f)*x/e) - 3*(b*d*e^2*f - (b*c + a*d)*e*f^2)*x)/(e*f^3)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 206 vs. \(2 (73) = 146\).

Time = 0.31 (sec) , antiderivative size = 206, normalized size of antiderivative = 2.54 \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=\frac {b d x^{3}}{3 f} + x \left (\frac {a d}{f} + \frac {b c}{f} - \frac {b d e}{f^{2}}\right ) - \frac {\sqrt {- \frac {1}{e f^{5}}} \left (a f - b e\right ) \left (c f - d e\right ) \log {\left (- \frac {e f^{2} \sqrt {- \frac {1}{e f^{5}}} \left (a f - b e\right ) \left (c f - d e\right )}{a c f^{2} - a d e f - b c e f + b d e^{2}} + x \right )}}{2} + \frac {\sqrt {- \frac {1}{e f^{5}}} \left (a f - b e\right ) \left (c f - d e\right ) \log {\left (\frac {e f^{2} \sqrt {- \frac {1}{e f^{5}}} \left (a f - b e\right ) \left (c f - d e\right )}{a c f^{2} - a d e f - b c e f + b d e^{2}} + x \right )}}{2} \]

[In]

integrate((b*x**2+a)*(d*x**2+c)/(f*x**2+e),x)

[Out]

b*d*x**3/(3*f) + x*(a*d/f + b*c/f - b*d*e/f**2) - sqrt(-1/(e*f**5))*(a*f - b*e)*(c*f - d*e)*log(-e*f**2*sqrt(-
1/(e*f**5))*(a*f - b*e)*(c*f - d*e)/(a*c*f**2 - a*d*e*f - b*c*e*f + b*d*e**2) + x)/2 + sqrt(-1/(e*f**5))*(a*f
- b*e)*(c*f - d*e)*log(e*f**2*sqrt(-1/(e*f**5))*(a*f - b*e)*(c*f - d*e)/(a*c*f**2 - a*d*e*f - b*c*e*f + b*d*e*
*2) + x)/2

Maxima [F(-2)]

Exception generated. \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((b*x^2+a)*(d*x^2+c)/(f*x^2+e),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(e>0)', see `assume?` for more
details)Is e

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.01 \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=\frac {{\left (b d e^{2} - b c e f - a d e f + a c f^{2}\right )} \arctan \left (\frac {f x}{\sqrt {e f}}\right )}{\sqrt {e f} f^{2}} + \frac {b d f^{2} x^{3} - 3 \, b d e f x + 3 \, b c f^{2} x + 3 \, a d f^{2} x}{3 \, f^{3}} \]

[In]

integrate((b*x^2+a)*(d*x^2+c)/(f*x^2+e),x, algorithm="giac")

[Out]

(b*d*e^2 - b*c*e*f - a*d*e*f + a*c*f^2)*arctan(f*x/sqrt(e*f))/(sqrt(e*f)*f^2) + 1/3*(b*d*f^2*x^3 - 3*b*d*e*f*x
 + 3*b*c*f^2*x + 3*a*d*f^2*x)/f^3

Mupad [B] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.33 \[ \int \frac {\left (a+b x^2\right ) \left (c+d x^2\right )}{e+f x^2} \, dx=x\,\left (\frac {a\,d+b\,c}{f}-\frac {b\,d\,e}{f^2}\right )+\frac {b\,d\,x^3}{3\,f}+\frac {\mathrm {atan}\left (\frac {\sqrt {f}\,x\,\left (a\,f-b\,e\right )\,\left (c\,f-d\,e\right )}{\sqrt {e}\,\left (a\,c\,f^2+b\,d\,e^2-a\,d\,e\,f-b\,c\,e\,f\right )}\right )\,\left (a\,f-b\,e\right )\,\left (c\,f-d\,e\right )}{\sqrt {e}\,f^{5/2}} \]

[In]

int(((a + b*x^2)*(c + d*x^2))/(e + f*x^2),x)

[Out]

x*((a*d + b*c)/f - (b*d*e)/f^2) + (b*d*x^3)/(3*f) + (atan((f^(1/2)*x*(a*f - b*e)*(c*f - d*e))/(e^(1/2)*(a*c*f^
2 + b*d*e^2 - a*d*e*f - b*c*e*f)))*(a*f - b*e)*(c*f - d*e))/(e^(1/2)*f^(5/2))